:root {
  --bg-main: #FFFFFF;
  --bg-secondary: #F4F6F8;
  --text-primary: #1A1D20;
  --text-muted: #68737D;
  --accent-silver: #A0AAB5;
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 15px 40px rgba(0, 0, 0, 0.1);
  --card-border: rgba(0,0,0,0.04);
  --btn-primary-bg: linear-gradient(135deg, #1A1D20 0%, #3A4148 100%);
  --radius: 16px;
}

html.dark-mode {
  --bg-main: #0D0F12;
  --bg-secondary: #16191D;
  --text-primary: #FFFFFF;
  --text-muted: #A0AAB5;
  --accent-silver: #4A525A;
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 15px 40px rgba(0, 0, 0, 0.6);
  --card-border: rgba(255,255,255,0.05);
  --btn-primary-bg: linear-gradient(135deg, #FFFFFF 0%, #E0E0E0 100%);
}

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  transition: background-color 0.3s ease, color 0.3s ease;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

.code-penal-container {
  max-width: 1200px;
  margin: clamp(30px, 5vw, 60px) auto;
  padding: 0 clamp(15px, 4vw, 30px);
  flex: 1;
  width: 100%;
  box-sizing: border-box;
}

.page-header {
  text-align: center;
  margin-bottom: clamp(30px, 5vw, 50px);
}

.page-header h2 {
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  color: var(--text-primary);
  margin-bottom: 15px;
  font-weight: 800;
  letter-spacing: -1px;
}

.page-header p {
  color: var(--text-muted);
  font-size: clamp(1rem, 3vw, 1.1rem);
}

.search-filter-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: clamp(30px, 5vw, 50px);
  gap: 20px;
  flex-wrap: wrap;
  background: var(--bg-secondary);
  padding: clamp(15px, 3vw, 20px);
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
}

.search-bar {
  flex: 1;
  position: relative;
  min-width: 250px;
}

.search-bar i {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-bar input {
  width: 100%;
  padding: 16px 20px 16px 45px;
  font-size: 15px;
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  background-color: var(--bg-main);
  color: var(--text-primary);
  box-sizing: border-box;
  transition: all 0.3s ease;
  font-family: inherit;
}

.search-bar input:focus {
  border-color: var(--text-primary);
  box-shadow: 0 0 0 3px rgba(160, 170, 181, 0.15);
  outline: none;
}

.filter-select {
  flex: 1;
  min-width: 250px;
}

.filter-select select {
  width: 100%;
  padding: 16px 45px 16px 20px;
  font-size: 15px;
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  background-color: var(--bg-main);
  color: var(--text-primary);
  appearance: none;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  background-image: url("data:image/svg+xml;utf8,<svg fill='%23A0AAB5' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 15px center;
  box-sizing: border-box;
}

.filter-select select:focus {
  border-color: var(--text-primary);
  box-shadow: 0 0 0 3px rgba(160, 170, 181, 0.15);
  outline: none;
}

#articles-list {
  display: flex;
  flex-direction: column;
  gap: clamp(30px, 5vw, 50px);
}

.category-title {
  font-size: clamp(1.3rem, 4vw, 1.5rem);
  color: var(--text-primary);
  margin: 0 0 25px 0;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--bg-secondary);
  font-weight: 700;
}

.category-articles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: clamp(15px, 3vw, 25px);
}

.article {
  background-color: var(--bg-main);
  border-radius: var(--radius);
  padding: clamp(20px, 4vw, 30px);
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--card-border);
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.article::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--btn-primary-bg);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}

.article:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
}

.article:hover::before {
  transform: scaleX(1);
}

.article h4 {
  font-size: clamp(1.1rem, 3vw, 1.2rem);
  margin: 0 0 15px 0;
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.3;
}

.article-desc {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0 0 20px 0;
  flex-grow: 1;
}

.article-price {
  display: inline-block;
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 0.9rem;
  border: 1px solid var(--card-border);
  align-self: flex-start;
}

.reveal-up { opacity: 0; transform: translateY(30px); transition: all 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); }
.reveal-up.active { opacity: 1; transform: translate(0); }

@media (max-width: 768px) {
  .search-filter-container {
    flex-direction: column;
    align-items: stretch;
  }
  
  .search-bar, .filter-select {
    width: 100%;
  }
}